package clientGUI.userPanels;
import java.awt.GridLayout;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;

import college.User;

import clientGUI.userPanels.Controllers.ProcessLeaderPanelController;
import clientserver.Client;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class ProcessLeaderPanel extends UPanel {
	
	private JTextField reqID;
	private JTextField processldrTxt;
	ProcessLeaderPanelController c;
	
	public ProcessLeaderPanel(int id, Client cl, User cUser) {
		setLayout(null);
		
		c = new ProcessLeaderPanelController(id,cl);
		
		
		JLabel lblRequestId = new JLabel("Request ID:");
		lblRequestId.setBounds(69, 50, 78, 14);
		add(lblRequestId);
		
		reqID = new JTextField();
		reqID.setBounds(159, 47, 86, 20);
		add(reqID);
		reqID.setColumns(10);
		reqID.setText(""+id);
		
		JLabel lblProcessLeader = new JLabel("Process Leader:");
		lblProcessLeader.setBounds(61, 105, 86, 14);
		add(lblProcessLeader);
		
		processldrTxt = new JTextField();
		processldrTxt.setBounds(159, 102, 86, 20);
		add(processldrTxt);
		processldrTxt.setColumns(10);
		//User currUser = myframe.getUserlogged();
		//c.setUser(currUser);
		processldrTxt.setText(cUser.getLogin());
		
		JButton approve = new JButton("Appliance Complete");
		approve.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				c.approveProcessComplete();
			}
		});
		approve.setBounds(41, 207, 129, 23);
		add(approve);
		
		JButton btnApplianceIncomplete = new JButton("Appliance Incomplete");
		btnApplianceIncomplete.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
								
				myframe.SetMainUserPanel();
			}
		});
		btnApplianceIncomplete.setBounds(257, 207, 166, 23);
		add(btnApplianceIncomplete);
		
		JButton btnMainMenu = new JButton("Main Menu");
		btnMainMenu.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) 
			{
				myframe.SetMainUserPanel();
			}
		});
		btnMainMenu.setBounds(311, 266, 89, 23);
		add(btnMainMenu);
	}
}

